<?php

namespace app\index\controller\knowledge;

use app\index\service\CategoryService;
use app\index\service\KnowledgeCategoryService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * Category 控制器
 * Class Category
 * @package app\index\controller\knowledge;
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 * @see \app\index\validate\knowledge\Category
 */
class Category
{
    // 请求参数
    private Request $request;

    // service
    private KnowledgeCategoryService $service;

    public function __construct(Request $request, KnowledgeCategoryService $categoryService)
    {
        $this->request = $request;
        $this->service = $categoryService;
    }

    /**
     * 知识分类 列表
     * @return ApiResponse
     * @url /knowledge/category/index
     */
    public function index(): ApiResponse
    {
        return ApiResponse::success($this->service->index());
    }

}
